package com.sphd.emanu.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.pojo.order.OrderItems;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/8/5 --10:55.
 * @Email 87683202@qq.com
 */
public class OrdersDetailAdapter extends BaseQuickAdapter<OrderItems, BaseViewHolder> {
    boolean showAllMoney;
    public OrdersDetailAdapter(@LayoutRes int layoutResId, @Nullable List<OrderItems> data, boolean showAllMoney) {
        super(layoutResId, data);
        this.showAllMoney=showAllMoney;
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderItems item) {
        helper
                .setText(R.id.food_name,item.getDishesName())
                .setText(R.id.food_no,"x"+String.valueOf(item.getQuantity()))
                .setText(R.id.food_price,"￥"+item.getOriginalPrice().toString())
                .setText(R.id.food_vip_price,"￥"+item.getPrice().toString())
                .setVisible(R.id.food_all_price,showAllMoney)
                .setText(R.id.food_all_price,"￥"+item.getAmount().toString());

    }
}
